const getNextWeek = (week, weekRepeatPower) => {
  if (weekRepeatPower) {
    return [...week, ...week];
  }

  return [...week, 0, 0, 0, 0, 0, 0, 0];
};

export const checkRepeat = (params, list) => {
  const currentRealRepeat = getNextWeek(params.repeat, params.weekRepeatPower);

  const confictArr = new Set();

  list.forEach(item => {
    if (item.startTime === params.startTime) {
      const itemRealRepeat = getNextWeek(item.repeat, item.weekRepeatPower);
      itemRealRepeat.forEach((week, index) => {
        if (week === 1 && currentRealRepeat[week] === 1) {
          confictArr.add(item.title);
        }
      });
    }
  });

  return [...confictArr];
};


